package com.googlecode.todo_robot;

import com.google.appengine.api.datastore.dev.LocalDatastoreService;
import com.google.appengine.tools.development.ApiProxyLocalImpl;
import com.google.apphosting.api.ApiProxy;
import org.junit.After;
import org.junit.Before;

/**
 * @author Fuad Ibrahimov
 * @since 08.01.2010
 */
public class BaseDbTestCase extends BaseTestCase {
  @Before
  public void dbSetUp() throws Exception {
    ApiProxyLocalImpl proxy = (ApiProxyLocalImpl) ApiProxy.getDelegate();
    proxy.setProperty(LocalDatastoreService.NO_STORAGE_PROPERTY, Boolean.TRUE.toString());
  }

  @After
  public void dbTearDown() throws Exception {
    ApiProxyLocalImpl proxy = (ApiProxyLocalImpl) ApiProxy.getDelegate();
    LocalDatastoreService datastoreService =
            (LocalDatastoreService) proxy.getService(LocalDatastoreService.PACKAGE);
    datastoreService.clearProfiles();
  }
}
